package com.tianqingwl.gsystem.content.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tianqingwl.gsystem.content.pojo.ContentType;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface ContentTypeMapper extends BaseMapper<ContentType> {

    /**
     * @param contentTypePage
     * @param typeName
     * @param type            类别的类别 1为类别 2为标签
     * @param contentId       标签使用
     * @return
     */
    IPage<ContentType> listContentTypePage(IPage<ContentType> contentTypePage,
                                      @Param("typeName") String typeName,
                                      @Param("type") Integer type,
                                      @Param("contentId") Long contentId);

    int deleteContentTagRelate(Long tagId);

    /**
     * 移除内容所有标签
     *
     * @param contentId
     */
    void deleteContentTagRelateByContentId(Long contentId);

    int addContentTagRelate(@Param("contentId") Long contentId, @Param("tagIds") List<Long> tagIds);

    ContentType selectTagByName(String tagName);

    IPage<ContentType> listContentTag(IPage<ContentType> contentTypePage, @Param("contentId") Long contentId);

    List<Map> listHotContentTag();
}
